package com.openbravo.pos.printer.screen;

import com.openbravo.pos.printer.ticket.BasicTicket;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Toolkit;
import java.util.Map;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;

class JTicket extends JPanel
{
  private static final int H_GAP = 8;
  private static final int V_GAP = 8;
  private static final int COLUMNS = 42;
  private static final int LINEWIDTH = 294;
  private BasicTicket basict;
  private Map desktophints;

  public JTicket(BasicTicket paramBasicTicket)
  {
    this.basict = paramBasicTicket;
    this.desktophints = ((Map)Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints"));
    initComponents();
  }

  protected void paintComponent(Graphics paramGraphics)
  {
    paintBorder(paramGraphics);
    Graphics2D localGraphics2D = (Graphics2D)paramGraphics;
    if (this.desktophints != null)
      localGraphics2D.addRenderingHints(this.desktophints);
    Insets localInsets = getInsets();
    localGraphics2D.setPaint(new GradientPaint(getWidth() - localInsets.left - localInsets.right - 100, getHeight() - localInsets.top - localInsets.bottom - 100, getBackground(), getWidth() - localInsets.left - localInsets.right, getHeight() - localInsets.top - localInsets.bottom, new Color(15790320), true));
    localGraphics2D.fillRect(localInsets.left, localInsets.top, getWidth() - localInsets.left - localInsets.right, getHeight() - localInsets.top - localInsets.bottom);
    paramGraphics.setColor(getForeground());
    this.basict.draw(localGraphics2D, localInsets.left + 8, localInsets.top + 8, 294);
  }

  public Dimension getPreferredSize()
  {
    Insets localInsets = getInsets();
    return new Dimension(310 + localInsets.left + localInsets.right, this.basict.getHeight() + 16 + localInsets.top + localInsets.bottom);
  }

  public Dimension getMaximumSize()
  {
    return getPreferredSize();
  }

  public Dimension getMinimumSize()
  {
    return getPreferredSize();
  }

  private void initComponents()
  {
    setLayout(new BorderLayout());
    setBackground(new Color(255, 255, 255));
    setBorder(new LineBorder(new Color(0, 0, 0)));
  }
}

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.pos.printer.screen.JTicket
 * JD-Core Version:    0.6.0
 */